using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Runtime.Serialization;
using System.Collections;
using System.Data;
using System.ComponentModel;
using System.Data.OracleClient;
using WPFExcelReport.Helpers;
using WPFExcelReport.Controls;
namespace WPFExcelReport
{
    public partial class VDRAUFTR
    {
 
        public void InsertDRAUFTR(DataRow dwData, string ITXDBVERSION = "50.24")
        {
            OracleCommand or1;
            or1 = OracleDB.CreateCommand();
            switch (ITXDBVERSION)
            {
                case "YGR":
                    or1.CommandText = "INSERT INTO DRAUFTR(VAKBMANDANT, VAKBKOLL, VAKBART, VAKBKUNDNR, VAKBFARBE, VAKBKDARTNR, VAKBKDARTBEZ, VAKBKDFARBNR, VAKBANDRUCK, VAKBMEGEW, VAKBMENGEH, VAKBGEWVON, VAKBGEWBIS, VAKBGEWCA, VAKBGEWFKT, VAKBGEWGRP, VAKBMEGFKT, VAKBMEGGRP, VAKBAENDZL, VAKBAENDBEN, VAKBAENDDAT, VAKBNEUBEN, VAKBNEUDAT, VAKBFILLER)"
                        + " VALUES (:VAKBMANDANT, :VAKBKOLL, :VAKBART, :VAKBKUNDNR, :VAKBFARBE, '                         ', '                         ', '                             ', ' ', '   ', '   ', 0, 0, ' ', '000000000000', ' ', '000000000000', ' ', 0, '        ', '000000', '        ', '      ', '                                          ')";
                    or1.Parameters.Add("VAKBMANDANT", OracleType.NVarChar).Value = dwData["VAKBMANDANT"].ToString();
                    or1.Parameters.Add("VAKBKOLL", OracleType.NVarChar).Value = dwData["VAKBKOLL"].ToString();
                    or1.Parameters.Add("VAKBART", OracleType.NVarChar).Value = dwData["VAKBART"].ToString();
                    or1.Parameters.Add("VAKBFARBE", OracleType.NVarChar).Value = dwData["VAKBFARBE"].ToString();
                    or1.Parameters.Add("VAKBKUNDNR", OracleType.NVarChar).Value = dwData["VAKBKUNDNR"].ToString();
                    break;
                //VAFMANDANT VAFKOLL VAFART VAFFARBE VAFBEZ VAFFFARBE

            }
            
            Connect2Proxy(or1);
        }
        public DataSet QueryDRAUFTR(DataRow dwData, int option = 1)
        {
            DataSet Return;
            DataSet Result = new DataSet();
            OracleCommand or1 = OracleDB.CreateCommand();
            switch (option)
            {
                case 0:
                    or1.CommandText = "SELECT * FROM DRAUFTR WHERE  ROWNUM<2 ";
                    break;
              
                case 99:
                    or1.CommandText = "SELECT * FROM DRAUFTR  WHERE ROWNUM<50";
                    break;
                default:
                    break;
            }
            Result = Connect2Proxy(or1);
            if (Result.Tables.Count > 0)
                Result.Tables[0].TableName = "DRAUFTR";
            Return = Result;
            return Return;
        }
        public void DeleteDRAUFTR(DataRow dwData, int option = 1)
        {

            OracleCommand or1 = OracleDB.CreateCommand();
            switch (option)
            {
                case 1:
                    or1.CommandText = "DELETE FROM DRAUFTR   WHERE  VAKBMANDANT=:VAKBMANDANT AND VAKBKOLL=:VAKBKOLL AND VAKBART =:VAKBART AND VAKBFARBE=:VAKBFARBE AND VAKBKUNDNR=:VAKBKUNDNR";
                     or1.Parameters.Add("VAKBMANDANT", OracleType.NVarChar).Value = dwData["VAKBMANDANT"].ToString();
                    or1.Parameters.Add("VAKBKOLL", OracleType.NVarChar).Value = dwData["VAKBKOLL"].ToString();
                    or1.Parameters.Add("VAKBART", OracleType.NVarChar).Value = dwData["VAKBART"].ToString();
                    or1.Parameters.Add("VAKBFARBE", OracleType.NVarChar).Value = dwData["VAKBFARBE"].ToString();
                    or1.Parameters.Add("VAKBKUNDNR", OracleType.NVarChar).Value = dwData["VAKBKUNDNR"].ToString();
                    break;
                default:
                    break;
            }
            Connect2Proxy(or1);
        } 
      
        public void UpdateDRAUFTR(DataRow dwData, string ITXDBVERSION = "50.24", int option = 1)
        {
            OracleCommand or1;
            DataSet Result = new DataSet();
            or1 = OracleDB.CreateCommand();
            switch (option)
            {
                case 1:
                    #region====Command==== 
                    or1.CommandText = "UPDATE DRAUFTR SET "
                    +"DRAMANDANT= :DRAMANDANT,"
                    +"DRABENID= :DRABENID,"
                    +"DRAAUFTNR= :DRAAUFTNR,"
                    +"DRALIST= :DRALIST,"
                    +"DRAZUSATZ= :DRAZUSATZ,"
                    +"DRADRUCK= :DRADRUCK,"
                    +"DRADRUCKB= :DRADRUCKB,"
                    +"DRAFORM= :DRAFORM,"
                    +"DRAFORMB= :DRAFORMB,"
                    +"DRALOGTER= :DRALOGTER,"
                    +"DRAKOP= :DRAKOP,"
                    +"DRASTA= :DRASTA,"
                    +"DRARC= :DRARC,"
                    +"DRAMNR= :DRAMNR,"
                    +"DRAMPAR1= :DRAMPAR1,"
                    +"DRAMPAR2= :DRAMPAR2,"
                    +"DRAMPAR3= :DRAMPAR3,"
                    +"DRAADAT= :DRAADAT,"
                    +"DRAAUHR= :DRAAUHR,"
                    +"DRADDAT= :DRADDAT,"
                    +"DRADUHR= :DRADUHR,"
                    +"DRADANZ= :DRADANZ,"
                    +"DRAAENDBEN= :DRAAENDBEN,"
                    +"DRAAENDZL= :DRAAENDZL,"
                    +"DRAFORMAT= :DRAFORMAT,"
                    +"DRATYP= :DRATYP,"
                    +"DRADEV= :DRADEV,"
                    +"DRABTA= :DRABTA,"
                    +"DRADBRT= :DRADBRT,"
                    +"DRAANZS= :DRAANZS,"
                    +"DRADBL= :DRADBL,"
                    +"DRASPRACHKZ= :DRASPRACHKZ,"
                    +"DRADRTRB= :DRADRTRB,"
                    +"DRADHOE= :DRADHOE,"
                    +"DRADSFKT= :DRADSFKT,"
                    +"DRANOPRINT= :DRANOPRINT,"
                    +"DRASPAETER= :DRASPAETER,"
                    +"DRASUBSYS= :DRASUBSYS,"
                    +"DRAFAXTRB= :DRAFAXTRB,"
                    +"DRADECKBL= :DRADECKBL,"
                    +"DRAKDLIKZ= :DRAKDLIKZ,"
                    +"DRAKDLINR= :DRAKDLINR,"
                    +"DRAADRSL= :DRAADRSL,"
                    +"DRAANSP= :DRAANSP,"
                    +"DRAFAXVERZ= :DRAFAXVERZ,"
                    +"DRAMAILADR= :DRAMAILADR,"
                    +"DRAMAILZUSTYP= :DRAMAILZUSTYP,"
                    +"DRAMAILZUS= :DRAMAILZUS,"
                    +"DRADATEIASG= :DRADATEIASG,"
                    +"DRAESPRKZ= :DRAESPRKZ,"
                    +"DRADATKZ= :DRADATKZ,"
                    +"DRAZEITKZ= :DRAZEITKZ,"
                    +"DRABETRKZ= :DRABETRKZ,"
                    +"DRAMGKZ= :DRAMGKZ,"
                    +"DRALOEKZ= :DRALOEKZ,"
                    +"DRAARCHIVKZ= :DRAARCHIVKZ,"
                    +"DRAARCHIVLFD= :DRAARCHIVLFD,"
                    +"DRATRACE= :DRATRACE,"
                    +"DRADRSTOFF= :DRADRSTOFF,"
                    +"DRAANPROG= :DRAANPROG,"
                    +"DRAAZEIT= :DRAAZEIT,"
                    +"DRAUGP= :DRAUGP,"
                    +"DRAMPID= :DRAMPID,"
                    +"DRAINST= :DRAINST,"
                    +"DRAPID= :DRAPID,"
                    +"DRAURLIST= :DRAURLIST,"
                    +"DRACMD= :DRACMD,"
                    +"DRAINFKZ= :DRAINFKZ,"
                    +"DRATRBTYP= :DRATRBTYP,"
                    +"DRAOUTDIR= :DRAOUTDIR,"
                    +"DRAART= :DRAART,"
                    +"DRAFILLER= :DRAFILLER,"
                        + " WHERE  "
                        + "  VAKBMANDANT=:VAKBMANDANT AND VAKBKOLL=:VAKBKOLL AND VAKBART =:VAKBART AND VAKBFARBE=:VAKBFARBE AND VAKBKUNDNR=:VAKBKUNDNR";
                    #endregion

                    #region====Parameters====
          or1.Parameters.Add("DRAMANDANT", OracleType.NVarChar).Value = dwData["DRAMANDANT"].ToString(); 
          or1.Parameters.Add("DRABENID", OracleType.NVarChar).Value = dwData["DRABENID"].ToString(); 
          or1.Parameters.Add("DRAAUFTNR", OracleType.NVarChar).Value = dwData["DRAAUFTNR"].ToString(); 
          or1.Parameters.Add("DRALIST", OracleType.NVarChar).Value = dwData["DRALIST"].ToString(); 
          or1.Parameters.Add("DRAZUSATZ", OracleType.NVarChar).Value = dwData["DRAZUSATZ"].ToString(); 
          or1.Parameters.Add("DRADRUCK", OracleType.NVarChar).Value = dwData["DRADRUCK"].ToString(); 
          or1.Parameters.Add("DRADRUCKB", OracleType.NVarChar).Value = dwData["DRADRUCKB"].ToString(); 
          or1.Parameters.Add("DRAFORM", OracleType.NVarChar).Value = dwData["DRAFORM"].ToString(); 
          or1.Parameters.Add("DRAFORMB", OracleType.NVarChar).Value = dwData["DRAFORMB"].ToString(); 
          or1.Parameters.Add("DRALOGTER", OracleType.NVarChar).Value = dwData["DRALOGTER"].ToString(); 
          or1.Parameters.Add("DRAKOP", OracleType.NVarChar).Value = dwData["DRAKOP"].ToString(); 
          or1.Parameters.Add("DRASTA", OracleType.NVarChar).Value = dwData["DRASTA"].ToString(); 
          or1.Parameters.Add("DRARC", OracleType.NVarChar).Value = dwData["DRARC"].ToString(); 
          or1.Parameters.Add("DRAMNR", OracleType.NVarChar).Value = dwData["DRAMNR"].ToString(); 
          or1.Parameters.Add("DRAMPAR1", OracleType.NVarChar).Value = dwData["DRAMPAR1"].ToString(); 
          or1.Parameters.Add("DRAMPAR2", OracleType.NVarChar).Value = dwData["DRAMPAR2"].ToString(); 
          or1.Parameters.Add("DRAMPAR3", OracleType.NVarChar).Value = dwData["DRAMPAR3"].ToString(); 
          or1.Parameters.Add("DRAADAT", OracleType.NVarChar).Value = dwData["DRAADAT"].ToString(); 
          or1.Parameters.Add("DRAAUHR", OracleType.NVarChar).Value = dwData["DRAAUHR"].ToString(); 
          or1.Parameters.Add("DRADDAT", OracleType.NVarChar).Value = dwData["DRADDAT"].ToString(); 
          or1.Parameters.Add("DRADUHR", OracleType.NVarChar).Value = dwData["DRADUHR"].ToString(); 
          or1.Parameters.Add("DRADANZ", OracleType.NVarChar).Value = dwData["DRADANZ"].ToString(); 
          or1.Parameters.Add("DRAAENDBEN", OracleType.NVarChar).Value = dwData["DRAAENDBEN"].ToString(); 
          or1.Parameters.Add("DRAAENDZL", OracleType.NVarChar).Value = dwData["DRAAENDZL"].ToString(); 
          or1.Parameters.Add("DRAFORMAT", OracleType.NVarChar).Value = dwData["DRAFORMAT"].ToString(); 
          or1.Parameters.Add("DRATYP", OracleType.NVarChar).Value = dwData["DRATYP"].ToString(); 
          or1.Parameters.Add("DRADEV", OracleType.NVarChar).Value = dwData["DRADEV"].ToString(); 
          or1.Parameters.Add("DRABTA", OracleType.NVarChar).Value = dwData["DRABTA"].ToString(); 
          or1.Parameters.Add("DRADBRT", OracleType.NVarChar).Value = dwData["DRADBRT"].ToString(); 
          or1.Parameters.Add("DRAANZS", OracleType.NVarChar).Value = dwData["DRAANZS"].ToString(); 
          or1.Parameters.Add("DRADBL", OracleType.NVarChar).Value = dwData["DRADBL"].ToString(); 
          or1.Parameters.Add("DRASPRACHKZ", OracleType.NVarChar).Value = dwData["DRASPRACHKZ"].ToString(); 
          or1.Parameters.Add("DRADRTRB", OracleType.NVarChar).Value = dwData["DRADRTRB"].ToString(); 
          or1.Parameters.Add("DRADHOE", OracleType.NVarChar).Value = dwData["DRADHOE"].ToString(); 
          or1.Parameters.Add("DRADSFKT", OracleType.NVarChar).Value = dwData["DRADSFKT"].ToString(); 
          or1.Parameters.Add("DRANOPRINT", OracleType.NVarChar).Value = dwData["DRANOPRINT"].ToString(); 
          or1.Parameters.Add("DRASPAETER", OracleType.NVarChar).Value = dwData["DRASPAETER"].ToString(); 
          or1.Parameters.Add("DRASUBSYS", OracleType.NVarChar).Value = dwData["DRASUBSYS"].ToString(); 
          or1.Parameters.Add("DRAFAXTRB", OracleType.NVarChar).Value = dwData["DRAFAXTRB"].ToString(); 
          or1.Parameters.Add("DRADECKBL", OracleType.NVarChar).Value = dwData["DRADECKBL"].ToString(); 
          or1.Parameters.Add("DRAKDLIKZ", OracleType.NVarChar).Value = dwData["DRAKDLIKZ"].ToString(); 
          or1.Parameters.Add("DRAKDLINR", OracleType.NVarChar).Value = dwData["DRAKDLINR"].ToString(); 
          or1.Parameters.Add("DRAADRSL", OracleType.NVarChar).Value = dwData["DRAADRSL"].ToString(); 
          or1.Parameters.Add("DRAANSP", OracleType.NVarChar).Value = dwData["DRAANSP"].ToString(); 
          or1.Parameters.Add("DRAFAXVERZ", OracleType.NVarChar).Value = dwData["DRAFAXVERZ"].ToString(); 
          or1.Parameters.Add("DRAMAILADR", OracleType.NVarChar).Value = dwData["DRAMAILADR"].ToString(); 
          or1.Parameters.Add("DRAMAILZUSTYP", OracleType.NVarChar).Value = dwData["DRAMAILZUSTYP"].ToString(); 
          or1.Parameters.Add("DRAMAILZUS", OracleType.NVarChar).Value = dwData["DRAMAILZUS"].ToString(); 
          or1.Parameters.Add("DRADATEIASG", OracleType.NVarChar).Value = dwData["DRADATEIASG"].ToString(); 
          or1.Parameters.Add("DRAESPRKZ", OracleType.NVarChar).Value = dwData["DRAESPRKZ"].ToString(); 
          or1.Parameters.Add("DRADATKZ", OracleType.NVarChar).Value = dwData["DRADATKZ"].ToString(); 
          or1.Parameters.Add("DRAZEITKZ", OracleType.NVarChar).Value = dwData["DRAZEITKZ"].ToString(); 
          or1.Parameters.Add("DRABETRKZ", OracleType.NVarChar).Value = dwData["DRABETRKZ"].ToString(); 
          or1.Parameters.Add("DRAMGKZ", OracleType.NVarChar).Value = dwData["DRAMGKZ"].ToString(); 
          or1.Parameters.Add("DRALOEKZ", OracleType.NVarChar).Value = dwData["DRALOEKZ"].ToString(); 
          or1.Parameters.Add("DRAARCHIVKZ", OracleType.NVarChar).Value = dwData["DRAARCHIVKZ"].ToString(); 
          or1.Parameters.Add("DRAARCHIVLFD", OracleType.NVarChar).Value = dwData["DRAARCHIVLFD"].ToString(); 
          or1.Parameters.Add("DRATRACE", OracleType.NVarChar).Value = dwData["DRATRACE"].ToString(); 
          or1.Parameters.Add("DRADRSTOFF", OracleType.NVarChar).Value = dwData["DRADRSTOFF"].ToString(); 
          or1.Parameters.Add("DRAANPROG", OracleType.NVarChar).Value = dwData["DRAANPROG"].ToString(); 
          or1.Parameters.Add("DRAAZEIT", OracleType.NVarChar).Value = dwData["DRAAZEIT"].ToString(); 
          or1.Parameters.Add("DRAUGP", OracleType.NVarChar).Value = dwData["DRAUGP"].ToString(); 
          or1.Parameters.Add("DRAMPID", OracleType.NVarChar).Value = dwData["DRAMPID"].ToString(); 
          or1.Parameters.Add("DRAINST", OracleType.NVarChar).Value = dwData["DRAINST"].ToString(); 
          or1.Parameters.Add("DRAPID", OracleType.NVarChar).Value = dwData["DRAPID"].ToString(); 
          or1.Parameters.Add("DRAURLIST", OracleType.NVarChar).Value = dwData["DRAURLIST"].ToString(); 
          or1.Parameters.Add("DRACMD", OracleType.NVarChar).Value = dwData["DRACMD"].ToString(); 
          or1.Parameters.Add("DRAINFKZ", OracleType.NVarChar).Value = dwData["DRAINFKZ"].ToString(); 
          or1.Parameters.Add("DRATRBTYP", OracleType.NVarChar).Value = dwData["DRATRBTYP"].ToString(); 
          or1.Parameters.Add("DRAOUTDIR", OracleType.NVarChar).Value = dwData["DRAOUTDIR"].ToString(); 
          or1.Parameters.Add("DRAART", OracleType.NVarChar).Value = dwData["DRAART"].ToString(); 
          or1.Parameters.Add("DRAFILLER", OracleType.NVarChar).Value = dwData["DRAFILLER"].ToString(); 
                    #endregion
                    break; 
                default:
                    break;
            }


            Connect2Proxy(or1);
        }
    }
}
